From 627a11455d64d5afabe37941133f5374d112f509 Mon Sep 17 00:00:00 2001 From: "rneugeba@wyvis.research" Date: Mon, 21 Jul 2003 09:51:43 +0000 Subject: [PATCH] bitkeeper revision 1.358.2.1 (3f1bb7afICZyxwHMLR8ad8KA9BhNVw) fix virtual time overrun --- BitKeeper/etc/logging_ok | 1 + xen/common/schedule.c | 20 ++++++++++++++++++-- xen/include/xeno/sched.h | 4 ++-- 3 files changed, 21 insertions(+), 4 deletions(-) diff --git a/BitKeeper/etc/logging_ok b/BitKeeper/etc/logging_ok index 8f77187647..cfbe120742 100644 --- a/BitKeeper/etc/logging_ok +++ b/BitKeeper/etc/logging_ok @@ -19,6 +19,7 @@ rac61@labyrinth.cl.cam.ac.uk rgr22@boulderdash.cl.cam.ac.uk rn@wyvis.camb.intel-research.net rn@wyvis.research.intel-research.net +rneugeba@wyvis.research rneugeba@wyvis.research.intel-research.net smh22@boulderdash.cl.cam.ac.uk smh22@labyrinth.cl.cam.ac.uk diff --git a/xen/common/schedule.c b/xen/common/schedule.c index 900728175f..cbb2193976 100644 --- a/xen/common/schedule.c +++ b/xen/common/schedule.c @@ -314,7 +314,7 @@ asmlinkage void schedule(void) now = NOW(); - /* remove timer, if till on list */ + /* remove timer, if still on list */ rem_ac_timer(&schedule_data[this_cpu].s_timer); /* deschedule the current domain */ @@ -382,7 +382,6 @@ asmlinkage void schedule(void) next_prime_evt = 0xffffffff; min_avt = 0xffffffff; /* to calculate svt */ - list_for_each(tmp, &schedule_data[this_cpu].runqueue) { p = list_entry(tmp, struct task_struct, run_list); if (p->evt < next_evt) { @@ -406,6 +405,22 @@ asmlinkage void schedule(void) /* update system virtual time */ if (min_avt != 0xffffffff) schedule_data[this_cpu].svt = min_avt; + /* check for virtual time overrun on this cpu */ + if (schedule_data[this_cpu].svt >= 0xf0000000) { + u_long t_flags; + write_lock_irqsave(&tasklist_lock, t_flags); + p = &idle0_task; + do { + if (p->processor == this_cpu && !is_idle_task(p)) { + p->evt -= 0xe0000000; + p->avt -= 0xe0000000; + } + } while ( (p = p->next_task) != &idle0_task ); + write_unlock_irqrestore(&tasklist_lock, t_flags); + schedule_data[this_cpu].svt -= 0xe0000000; + } + + /* work out time for next run through scheduler */ if (is_idle_task(next)) { r_time = ctx_allow; goto sched_done; @@ -449,6 +464,7 @@ asmlinkage void schedule(void) spin_unlock_irq(&schedule_data[this_cpu].lock); + /* done, switch tasks */ if ( unlikely(prev == next) ) { /* We won't go through the normal tail, so do this by hand */ diff --git a/xen/include/xeno/sched.h b/xen/include/xeno/sched.h index ffec7d427b..9af0b54e12 100644 --- a/xen/include/xeno/sched.h +++ b/xen/include/xeno/sched.h @@ -115,8 +115,8 @@ struct task_struct s_time_t wokenup; /* time domain got woken up */ unsigned long mcu_advance; /* inverse of weight */ - s32 avt; /* actual virtual time */ - s32 evt; /* effective virtual time */ + u32 avt; /* actual virtual time */ + u32 evt; /* effective virtual time */ int warpback; /* warp? */ long warp; /* virtual time warp */ long warpl; /* warp limit */ -- 2.30.2